using System;
using System.Xml;
using System.Configuration;

namespace CSharpDistilled.Diagnostics
{
    /// <summary>
    /// Handles the logging configuration section.
    /// </summary>
    internal sealed class LoggingConfigurationHandler : IConfigurationSectionHandler
    {
        #region public object Create(object parent, object configContext, XmlNode section)

        /// <summary>
        /// Creates a configuration section handler to handle the logging configuration section.
        /// </summary>
        /// <param name="parent">Parent object.</param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section">Section XML node.</param>
        /// <returns>The created section handler object.</returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            ProviderConfiguration configuration = new ProviderConfiguration();

            configuration.ProcessLoggingConfigurationSection(section);

            return configuration;
        }

        #endregion
    }
}
